<template>
  <div class="actions-container">
    <a-button @click="handlerCancel">返回</a-button>
    <a-button type="primary" @click="hanlderModify">
      编辑
    </a-button>
    <a-button type="danger" ghost @click="handlerDelete">删除</a-button>
  </div>
</template>

<script>
import { deleleGroup } from '@/api/flow/group'
import props from '../mixins/props'

export default {
  mixins: [props],

  methods: {
    handlerDelete () {
      deleleGroup(this.gid)
        .then(() => {
          this.$router.push({
            name: 'Jurisdiction',
          })

          this.$notification.success({
            message: '删除成功!',
            duration: 1,
          })
        })
    },

    // 取消
    handlerCancel () {
      this.$router.go(-1)
    },

    hanlderModify () {
      this.$router.push({
        name: 'JurisdictionEdit',
        params: {
          gid: this.gid,
        },
      })
    },
  },
}

</script>

<style lang="scss" scoped>
.actions-container {
  button {
    margin: 0 $margin-base;
  }
}
</style>
